Using a Callback Function to Process Driver Messages

You can write your own callback function to process messages sent by the device driver. To use a callback function, specify the CALLBACK_FUNCTION flag in the fdwOpen parameter and the address of the callback in the dwCallback parameter of the waveInOpenDZFQLF or waveOutOpen2MUO.P_ function.

Messages sent to a callback function are similar to messages sent to a window, except they have two DWORD parameters instead of a UINT and a DWORD parameter. For details on these messages, see Playing Waveform-Audio Files40DX031.

To pass instance data from an application to a callback function, use one of the following techniques:

    Pass the instance data using the dwInstance parameter of the function that opens the device driver.

    Pass the instance data using the dwUser member of the WAVEHDR3CAL0JU structure that identifies an audio data block being sent to a device driver.

 

If you need more than 32 bits of instance data, pass a pointer to a structure containing the additional information.